ae98e4f4b8892ae85d71bccd7e20ef558856262a,maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java,DefaultLifecycleExecutor,findMappingsForLifecycle,#MavenSession#MavenProject#,931

Before Change



        try
        {
            m = (LifecycleMapping) findExtension( project, LifecycleMapping.ROLE, packaging, session.getSettings(),
                                                  session.getLocalRepository() );
        }
        catch ( PluginVersionResolutionException e )
        {
            throw new LifecycleExecutionException(
                "Cannot load extension plugin obtaining lifecycle mappings for: \'" + packaging + "\'.", e );
        }
        catch ( PluginManagerException e )
        {
            throw new LifecycleExecutionException(
                "Cannot load extension plugin obtaining lifecycle mappings for: \'" + packaging + "\'.", e );
        }

        if ( m == null )
        {
            try
            {
                m = (LifecycleMapping) session.lookup( LifecycleMapping.ROLE, packaging );
            }
            catch ( ComponentLookupException e )
            {
                throw new LifecycleExecutionException(
                    "Cannot find lifecycle mapping for packaging: \'" + packaging + "\'.", e );
            }
        }

        return m.getPhases();
    }

    private Object findExtension( MavenProject project, String role, String roleHint, Settings settings,

After Change


        throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException
    {
        String packaging = project.getPackaging();
        Map mappings = null;

        try
        {
            LifecycleMapping m = (LifecycleMapping) findExtension( project, LifecycleMapping.ROLE, packaging,
                                                                   session.getSettings(),
                                                                   session.getLocalRepository() );
            if ( m != null )
            {
                mappings = m.getPhases( lifecycle.getId() );
            }
        }
        catch ( PluginVersionResolutionException e )
        {
            throw new LifecycleExecutionException(
                "Cannot load extension plugin obtaining lifecycle mappings for: \'" + packaging + "\'.", e );
        }
        catch ( PluginManagerException e )
        {
            throw new LifecycleExecutionException(
                "Cannot load extension plugin obtaining lifecycle mappings for: \'" + packaging + "\'.", e );
        }

        Map defaultMappings = lifecycle.getDefaultPhases();

        if ( mappings == null )
        {
            try
            {
                LifecycleMapping m = (LifecycleMapping) session.lookup( LifecycleMapping.ROLE, packaging );
                mappings = m.getPhases( lifecycle.getId() );
            }
            catch ( ComponentLookupException e )
            {
                if ( defaultMappings == null )
                {
                    throw new LifecycleExecutionException(
                        "Cannot find lifecycle mapping for packaging: \'" + packaging + "\'.", e );
                }
            }
        }

        if ( mappings == null )
        {
            if ( defaultMappings == null )
            {
                throw new LifecycleExecutionException(
                    "Cannot find lifecycle mapping for packaging: \'" + packaging + "\', and there is no default" );
            }
            else
            {
                mappings = defaultMappings;
            }
        }

        return mappings;
    }

    private Object findExtension( MavenProject project, String role, String roleHint, Settings settings,